function getTotalCount(obj){
	var totalCount = obj.getGridParam('records');
	if(totalCount === null || totalCount === ''){
		return 0;
    }
	return totalCount;
}

function loadQueryUsingTable() {
	$("#queryUsingGridTable").jqGrid({url:"using_log.action", 
										datatype:"json", 
										height:500, 
										width:940, 
										colNames:[ "图片", "宝贝", "安装时间", "显示位置", "静态推广位", "动态推广位", "更换频率", "主宝贝编码"], 
										colModel:[   
													{name:"IMG", index:"IMG", formatter:formateadorLink1, sortable:false, align:"center", width:"40px"}, 
													{name:"TITLE", index:"TITLE", formatter:formateadorLink3, align:"center",  width:"100"}, 
													{name:"START_TIME", index:"START_TIME", align:"center", width:"90"}, 
													{name:"INSTALL_PLACE_DESC", index:"INSTALL_PLACE_DESC", align:"center", width:"90"},
													{name:"STATIC_NUM_DESC", index:"STATIC_NUM_DESC", sorttype:"int", align:"center", width:"70"}, 
													{name:"INTELL_SETTING_DESC", index:"INTELL_SETTING_DESC", align:"center", width:"200"},
												 	{name:"FREQUENCY_DESC", index:"FREQUENCY_DESC", align:"center", width:"60"},
												  	{name:"IID", index:"IID", hidden: true}],
									  	viewrecords:true,
									  	rowNum:10, 
									  	rowList:[10, 20, 30], 
									  	multiselectWidth:50, 
									  	loadComplete:function () {
											setImageCellHeight("queryUsingGridTable");
										}, 
										postData:{
											'pager.totalCount':function(){return getTotalCount($("#queryUsingGridTable"));}
										},	
										jsonReader:{root:"dataset", 
													page:"pager.curPageNo", 
													total:"pager.totalPages", 
													records:"pager.totalCount", 
													repeatitems:false
										}, 
										prmNames:{  rows:"pager.pageSize", 
													page:"pager.curPageNo", 
													sort:"pager.orderBy", 
													order:"pager.order"
										}, 
										pager:"#queryUsingGridPager", 
										caption:"安装了推广模块的宝贝列表"
	});
}

function formateadorLink3(cellvalue, options, rowObject) {
	var title = "<span style='text-decoration:underline;font-size:13px;color:blue;'>" + cellvalue + "</span>";
	return "<a href=http://item.taobao.com/item.htm?id=" + rowObject.IID + " target='_blank'>" + title + "</a>";
}



